home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / vsoup11.zip / socket.hh < prev    next >
Text File  |  1996-09-02  |  1KB  |  54 lines

  1. //  $Id: socket.hh 1.7 1996/09/02 13:30:36 hardy Exp $
  2. //
  3. //  This progam/module was written by Hardy Griech based on ideas and
  4. //  pieces of code from Chin Huang (cthuang@io.org).  Bug reports should
  5. //  be submitted to rgriech@ibm.net.
  6. //
  7. //  This file is part of soup++ for OS/2.  Soup++ including this file
  8. //  is freeware.  There is no warranty of any kind implied.  The terms
  9. //  of the GNU Gernal Public Licence are valid for this piece of software.
  10. //
  11.  
  12.  
  13. #ifndef __SOCKET_HH__
  14. #define __SOCKET_HH__
  15.  
  16.  
  17. class TSocket {
  18. public:
  19.     enum TState {init,connecting,connected,closed};
  20.  
  21. private:
  22.     TState State;
  23.     int  sock;
  24.     unsigned char *Buffer;
  25.     int  BuffSize;
  26.     int  BuffEnd;
  27.     int  BuffNdx;
  28.     const char *ipAdr;
  29.     const char *service;
  30.     const char *protocol;
  31.  
  32.     int send( void *src, int len );
  33.     int nextchar( void );
  34.  
  35. public:
  36.     TSocket( void );
  37.     TSocket( const TSocket &right );     // copy constructor not allowed !
  38.     ~TSocket();
  39.     operator = (const TSocket &right);   // assignment operator not allowed !
  40.  
  41.     void close( void );
  42.     int open( const char *ipAdr, const char *service, const char *protocol,
  43.           int buffSize=4096 );
  44.     int puts( const char *s );
  45.     int printf( const char *fmt, ... );
  46.     char *gets( char *buff, int bufflen );
  47.  
  48.     TState state( void ) { return State; }
  49.     const char *getIpAdr( void ) { return ipAdr; }
  50. };
  51.  
  52.  
  53. #endif
  54.